package controller;

import java.io.FileWriter;
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
public class NewsData {
	
	
	/*<div class="tc-panel tc-selected" id="data">
	
	</div>
	<div class="tc-panel" id="data2">
		
	</div>*/
	public static void main(String []args){
		try {
		Document doc = Jsoup.connect("http://news.naver.com/").get();
		Document data = new Document("");
		//data.append(doc.getElementsByClass("type14").toString());
		data.append("<div class=tc-panel tc-selected>");
		data.append(doc.getElementsByClass("type16").toString());
		data.append("</div>");
		System.out.println(data);
		/*for (int i = 0; i < data.getElementsByTag("a").size(); i++) {
			data.getElementsByTag("a").get(i).attr("href","http://news.naver.com" + data.getElementsByTag("a").get(i).attr("href"));
		}*/
		/*for (int i = 0; i < data.getElementsByTag("a").size(); i++) {
			data.getElementsByTag("a").get(i).attr("onclick", "openContent(http://news.naver.com" + data.getElementsByTag("a").get(i).attr("href")+")");
		}
		FileWriter out = new FileWriter(
		"E:\\9.NHN SM\\1.workplace\\130523_final\\step10_realtimeInfo\\WebContent\\total.data");
		out.write(data.getElementsByClass("type16").removeClass("type16").addClass("police_data").attr("id", "police").toString());
		out.write("\n");
		out.write(data.getElementsByClass("type16").removeClass("type16").addClass("economy_data").attr("id", "economy").toString());
		out.write("\n");
		out.write(data.getElementsByClass("type16").removeClass("type16").addClass("social_data").attr("id", "social").toString());
		out.write("\n");
		out.write(data.getElementsByClass("type16").removeClass("type16").addClass("culture_data").attr("id", "culture").toString());
		out.write("\n");
		out.write(data.getElementsByClass("type16").removeClass("type16").addClass("world_data").attr("id", "world").toString());
		out.write("\n");
		out.write(data.getElementsByClass("type16").removeClass("type16").addClass("it_data").attr("id", "it").toString());
		out.write("\n");
		out.write(data.getElementsByClass("type16").removeClass("type16").addClass("entertain_data").attr("id", "entertain").toString());
		out.write("\n");
		out.write(data.getElementsByClass("type16").removeClass("type16").addClass("sports_data").attr("id", "sports").toString());
		out.write("\n");
		out.close();*/
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	}
}
